package com.vimi8.ebb.auth.api;

import com.vimi8.ebb.auth.configuration.HttpResponseEntity;
import com.vimi8.ebb.auth.dto.OrgDto;
import com.vimi8.ebb.auth.model.Paginator;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by wangyang on 2016/12/20.
 */
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-09-14T06:39:56.874Z")

@Api(value = "farm", description = "the farm API")
@RestController
public interface FarmApi {

    @ApiOperation(value = "查询我加入的，我自己的农场列表", notes = "查询农场列表.", response = OrgDto.class,
            tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = OrgDto.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    // @PreAuthorize("#oauth2.hasScope('write:traceability-platform:farmer-user:me')")
    @RequestMapping(value = "/org/me/",
            method = RequestMethod.GET)
    HttpResponseEntity<Paginator<List<OrgDto>>> getfarmInfoListByUserId(
            @ApiParam(value = "页码", required = true) @RequestParam(value = "start", required = true) int start,
            @ApiParam(value = "每页数据大小", required = true) @RequestParam(value = "size", required = true) int size

    );


    @ApiOperation(value = "用户关注组织", notes = "用户关注组织", response = String.class,
            tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    // @PreAuthorize("#oauth2.hasScope('write:traceability-platform:farmer-user:me')")
    @RequestMapping(value = "/org/emp/follow/",
            method = RequestMethod.POST)
    HttpResponseEntity<String> userFarmRelationPost(
            @ApiParam(value = "农场id", required = true) @RequestParam(value = "farmId", required = true) String farmId,
            @ApiParam(value = "关系类型（1：关注）", required = true) @RequestParam(value = "relationType", required = true) String relationType
    );


    @ApiOperation(value = "用户取消关注组织", notes = "用户取消关注组织.", response = String.class,
            tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    // @PreAuthorize("#oauth2.hasScope('write:traceability-platform:farmer-user:me')")
    @RequestMapping(value = "/org/emp/follow/",
            method = RequestMethod.DELETE)
    HttpResponseEntity<String> userFarmRelationDelete(
            @ApiParam(value = "农场id", required = true) @RequestParam(value = "farmId", required = true) String farmId,
            @ApiParam(value = "关系类型（1：取消关注）", required = true) @RequestParam(value = "relationType", required = true) String relationType
    );

}
